<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="../../resources/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<script src="../../resources/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="../../resources/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
<script src="../../resources/lib/jquery/jquery.form.min.js" type="text/javascript"></script>
<script src="../../resources/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>
<script src="../../resources/lib/json2.js"></script>
<style type="text/css">
    .l-tree .l-tree-icon-none img{width:16px; height:16px; margin:3px;}
</style>
<script type="text/javascript">
var myaccount = '../../resources/lib/ligerUI/skins/icons/myaccount.gif';
var archives = '../../resources/lib/ligerUI/skins/icons/archives.gif';
var addNew = false;
var CustomersData =
{Rows:[{//"Conctrol":"控制器1",
           "Num":"89757",
            "Name":"大厅门"},
         {//"Conctrol":"控制器2",
            "Num":"89752",
            "Name":"实验室门"}],Total:2};
$(function (){
        $("#txt1").ligerComboBox({
            width : 180,
            selectBoxWidth: 200,
            selectBoxHeight: 200, valueField: 'text', treeLeafOnly: false,
            tree: { url: 'json.txt',ajaxType:'get'}
        });

    function getGridOptions(checkbox)
    {
        var options = {
            columns: [
//                { display: '控制器', name: 'Conctrol', align: 'left', width: 100, minWidth: 60 },
                { display: '门编号', name: 'Num', minWidth: 120, width: 100 },
                { display: '门名称', name: 'Name', minWidth: 140, width: 100 }
            ], switchPageSizeApplyComboBox: false,
            data: $.extend({}, CustomersData),
            pageSize: 30,
            checkbox: checkbox
        };
        return options;
    }

    $(function ()
    {

        $("#txt10").ligerComboBox({
            width: 250, slide: false,
            selectBoxWidth: 500, selectBoxHeight: 240,
            valueField: 'Name', textField: 'Name',
            grid: {
                columns: [
//                    { display: '控制器', name: 'Conctrol', align: 'left', width: 100, minWidth: 60 },
                    { display: '门编号', name: 'Num', width: 100 },
                    { display: '门名称', name: 'Name', width: 100 }
                ], switchPageSizeApplyComboBox: false,
                data: $.extend({}, CustomersData),
                pageSize: 30,
                checkbox: true
            }
        });
    });

    $("#listbox1").ligerListBox({
        isShowCheckBox: true, isMultiSelect: true,
        width : 180,
        data: [
            { text: '人组1', id: '1' },
            { text: '人组2', id: '2' },
            { text: '人组3', id: '3' },
            { text: '人组4', id: '5' },
            { text: '人组5', id: '6' },
            { text: '人组6', id: '7' },
            { text: '人组7', id: '8' }
        ]
    });


        $("#txt2").ligerComboBox({
            width : 180,
            selectBoxWidth: 200,
            selectBoxHeight: 200, valueField: 'text', treeLeafOnly: false,
            tree: { url: 'json.txt',ajaxType:'get'}
        });


        $("#txt3").ligerComboBox({
            width : 180,
            selectBoxWidth: 200,
            selectBoxHeight: 200, valueField: 'text', treeLeafOnly: false,
            tree: { url: 'json.txt',ajaxType:'get'}
        });

        tree = $("#tree2").ligerTree({
            checkbox: false,
            data: [
//                { text: '主控制器1', id:"1", type:"mc"},
//                { text: '主控制器2', id:"2", type:'mc'},
//                { text: '主控制器3', id:"3", type:'mc'},

//                { text: '门组1', id:"1.1", pid:"1", icon: myaccount, type:'dc'},
//                { text: '门组2', id:"1.2", pid:"1", icon: myaccount, type:'dc'},

                { text: '门组1', id:"1.1.1", pid:"1.1", icon: myaccount, type:'door'},
                { text: '门组2', id:"1.1.2", pid:"1.1", icon: myaccount, type:'door' }
            ],
            idFieldName :'id',
            parentIDFieldName :'pid',
            onSelect: function(node, target) {
                addNew = false;
                var type = node.data.type;
                if (type == 'mc') {
                    $("#dcForm").hide();
                    $("#doorForm").hide();
                    $("#doorForm1").hide();
                    $("#doorForm2").hide();
                    $("#doorForm3").hide();
                    $("#doorForm4").hide();
                    $("#doorForm5").hide();
                    $("#mcForm").show();
                    $("#mcForm input[name=name]").val(node.data.text);
                    $("#mcForm input[name=id]").val(node.data.id);
                    $("#addDCItemBtn").show();
                    $("#addDoorItemBtn").hide();
                } else if (type == 'dc') {
                    $("#mcForm").hide();
                    $("#doorForm").hide();
                    $("#doorForm1").hide();
                    $("#doorForm2").hide();
                    $("#doorForm3").hide();
                    $("#doorForm4").hide();
                    $("#doorForm5").hide();

                    $("#dcForm").show();

                    $("#dcForm input[name='name']").val(node.data.text);
                    $("#dcForm input[name=id]").val(node.data.id);
                    $("#dcForm input[name=pid]").val(null);// 删除pid属性

                    $("#addDCItemBtn").show();
                    $("#addDCItemBtn").hide();
                    $("#addDoorItemBtn").show();
                } else if (type == 'door') {
                    $("#mcForm").hide();
                    $("#dcForm").hide();
                    $("#doorForm").show();
                    $("#doorForm1").show();
                    $("#doorForm2").show();
                    $("#doorForm3").show();
                    $("#doorForm4").show();
                    $("#doorForm5").show();

                    $("#doorForm input[name='name']").val(node.data.text);
                    $("#doorForm1 input[name='name']").val(node.data.text);
                    $("#doorForm2 input[name='name']").val(node.data.text);
                    $("#doorForm3 input[name='name']").val(node.data.text);
                    $("#doorForm4 input[name='name']").val(node.data.text);
                    $("#doorForm5 input[name='name']").val(node.data.text);
                    $("#doorForm input[name=id]").val(node.data.id);
                    $("#doorForm2 input[name=id]").val(node.data.id);
                    $("#doorForm input[name=pid]").val(null);// 删除pid属性
                    $("#doorForm1 input[name=pid]").val(null);// 删除pid属性
                    $("#doorForm2 input[name=pid]").val(null);// 删除pid属性
                    $("#doorForm3 input[name=pid]").val(null);// 删除pid属性
                    $("#doorForm4 input[name=pid]").val(null);// 删除pid属性
                    $("#doorForm5 input[name=pid]").val(null);// 删除pid属性
                    $("#addDCItemBtn").hide();
//                    $("#addDoorItemBtn").hide();
                }
            }
        });

        $("form").ligerForm();
        $('#mcForm').ajaxForm(function() {
            alert("mc form ajax submit end!");
        });
        $('#dcForm').ajaxForm(function() {
            alert("dc form ajax submit end!");
        });
        $('#doorForm').ajaxForm(function() {
            alert("door form ajax submit end!");
        });
        $('#doorForm1').ajaxForm(function() {
            alert("door form ajax submit end!");
        });
        $('#doorForm2').ajaxForm(function() {
            alert("door form ajax submit end!");
        });
        $('#doorForm3').ajaxForm(function() {
            alert("door form ajax submit end!");
        });
        $('#doorForm4').ajaxForm(function() {
            alert("door form ajax submit end!");
        });
        $('#doorForm5').ajaxForm(function() {
            alert("door form ajax submit end!");
        });
    });

    function reload() {
        tree.clear();
        var data = [
//            { text: '主控制器1', id:"1", type:"mc"},
//            { text: '主控制器2', id:"2", type:'mc'},
//            { text: '主控制器3', id:"3", type:'mc'},

//            { text: '门组1', id:"1.1", pid:"1", icon: myaccount, type:'dc'},
//            { text: '门组2', id:"1.2", pid:"1", icon: myaccount, type:'dc'},

            { text: '门组1', id:"1.1.1", pid:"1.1", icon: myaccount, type:'door'},
            { text: '门组2', id:"1.1.2", pid:"1.1", icon: myaccount, type:'door' }
        ];
        tree.setData(data);
    }
        function addDoorItem() {
            $("#mcForm").hide();
            $("#dcForm").hide();
            $("#doorForm input[type=reset]").click();
            $("#doorForm input[name='name']").val("新建门组");
            var node = tree.getSelected();
            $("#doorForm input[name=id]").val(null);// 删除id属性
            $("#doorForm input[name=pid]").val(node.data.id);// 设置pid属性
            $("#doorForm").show();
//            alert("怎么不好使呢？")
        }
//    function updateItem() {
//
//    }
    function removeItem() {

    }


</script>
<style type="text/css">
    .l-table-edit {}
    .l-table-edit-td{ padding:4px;}
    .l-button-submit,.l-button-reset{width:80px; float:left; margin-left:10px; padding-bottom:2px;}
</style>
</head>
<body id="layout1" style="width:100%; margin:0 auto;">
<div style="position:absolute; left: 5px; top: 5px; right: 5px; height: 25px; ">
    <a class="l-button" onclick="reload()" style="float:left;margin-right:10px;">重新加载</a>
    <a class="l-button" id="addDoorItemBtn" onclick="addDoorItem()" style="float:left;margin-right:10px;">添加门组</a>

    <!--<a class="l-button" onclick="addMCItem()" style="float:left;margin-right:10px; width: 80px;">添加主控制器</a>-->
    <!--<a class="l-button l-hidden" id="addDCItemBtn" onclick="addDCItem()" style="float:left;margin-right:10px; width: 80px;">添加门控制器</a>-->
    <!--<a class="l-button" onclick="updateItem()" style="float:left;margin-right:10px;">更新</a>-->
    <a class="l-button" onclick="removeItem()" style="float:left;margin-right:10px;">删除</a>
    <div id="searchbar">
        &nbsp门组名称：<input id="txtKey" type="text" />
        <input id="btnOK"  class="l-button" type="button" value="搜索" onclick="f_search()" />
    </div>
    <br style="clear: both;" />
</div>

<div style="position:absolute; left: 5px; top: 35px; bottom: 5px; width: 190px; border:1px solid #ccc; overflow:auto;  ">
    <ul id="tree2">
    </ul>
</div>

<div style="position:absolute; left: 202px; right: 5px; top: 35px; bottom: 5px; border:1px solid #ccc; overflow:auto; padding: 5px;">
<div id="dialog_target"  style="margin:5px;">

<div id="navtab1" style="width: 900px; overflow: hidden; border: 1px solid #D3D3d3;" class="liger-tab">
    <div tabid="home" title="基本信息设置" lselected="true" style="height: 450px">
        <div id="maingrid2" style="margin: 10px; height: 300px;">

            <form class="l-hidden" name="doorForm" method="post" action="" id="doorForm">
                <div>
                </div>


                <table cellpadding="0" cellspacing="0" class="l-table-edit" >
                    <tr>
                        <td align="right" class="l-table-edit-td">名称:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="name" type="text" ltype="text" />
                        </td>
                        <td align="left"></td>
                    </tr>
                    <tr>
                        <td align="right" class="l-table-edit-td">编号:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="code" type="text" ltype="text" />
                        </td>
                        <td align="left"></td>
                    </tr>
                    <tr>
                        <td align="right" class="l-table-edit-td">门组包含的门:</td>
                        <td align="left" class="l-table-edit-td">
                            <input type="text" id="txt1" ltype="select"/>
                        </td>
                    </tr>

                    <tr>
                        <td align="right" class="l-table-edit-td">备注:</td>
                        <td align="left" class="l-table-edit-td">
                            <textarea cols="100" rows="4" class="l-textarea" style="width:400px"></textarea>
                        </td><td align="left"></td>
                    </tr>
                </table>
                <br />
                <input type="hidden" name="id" />
                <input type="hidden" name="pid" />
                <input type="submit" value="提交" class="l-button l-button-submit" />
                <input type="reset" value="重置" class="l-button l-button-reset"/>
                <br class="l-clear" />
            </form>
        </div>
    </div>
    <div title="门逻辑关系" showclose="false">
        <div id="Div1" style="margin: 10px; height: 450px;">
            <form class="l-hidden" name="doorForm1" method="post" action="" id="doorForm1">
                <div>
                </div>
                <table cellpadding="0" cellspacing="0" class="l-table-edit" >
                    <tr>
                        <td align="right" class="l-table-edit-td">互动模式:</td>
                        <td align="left" class="l-table-edit-td">
                            <select name="ddlDepart8" ltype="select">
                                <option value="1">关联互锁</option>
                                <option value="2">关联互开</option>
                                <option value="3">关联互锁互开</option>
                                <option value="4">前锁后开</option>
                                <option value="5">前开后锁</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="l-table-edit-td">相关联门组:</td>
                        <td align="left" class="l-table-edit-td">
                            <select name="ddlDepart7" ltype="select">
                                <option value="1">门组1</option>
                                <option value="2">门组2</option>
                                <option value="3">门组3</option>
                                <option value="4">门组4</option>
                                <option value="5">门组5</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="l-table-edit-td">通断时间（秒）:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="code" type="text" ltype="text" />
                        </td>
                        <td align="left"></td>
                    </tr>
                </table>
                <br />
                <input type="hidden" name="id" />
                <input type="hidden" name="pid" />
                <input type="submit" value="提交" class="l-button l-button-submit" />
                <input type="reset" value="重置" class="l-button l-button-reset"/>
                <br class="l-clear" />
            </form>

        </div>
    </div>
    <div title="时间规则" showclose="true">
        <div id="Div2" style="margin: 10px; height: 450px;">
            <form class="l-hidden" name="doorForm2" method="post" action="" id="doorForm2">


                <div>
                </div>
                <table cellpadding="0" cellspacing="0" class="l-table-edit" >

                    <tr>
                        <td align="right" class="l-table-edit-td">是否采用该规则:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="name" type="checkbox" ltype="checkbox" />
                        </td>
                        <td align="left"></td>
                    </tr>
                    <tr>
                        <td align="right" class="l-table-edit-td">节假日组:</td>
                        <td align="left" class="l-table-edit-td">
                            <select name="ddlDepart6" ltype="select">
                                <option value="1">节假1组</option>
                                <option value="2">节假2组</option>
                                <option value="3">节假3组</option>
                                <option value="4">节假4组</option>
                                <option value="5">节假5组</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="l-table-edit-td">时间域组:</td>
                        <td align="left" class="l-table-edit-td">
                            <select name="ddlDepart5" ltype="select">
                                <option value="1">时间1组</option>
                                <option value="2">时间2组</option>
                                <option value="3">时间3组</option>
                                <option value="4">时间4组</option>
                                <option value="5">时间5组</option>
                            </select>
                        </td>
                    </tr>
                </table>
                <br />
                <input type="hidden" name="id" />
                <input type="hidden" name="pid" />
                <input type="submit" value="提交" class="l-button l-button-submit" />
                <input type="reset" value="重置" class="l-button l-button-reset"/>
                <br class="l-clear" />
            </form>

        </div>
    </div>


    <div title="多人规则" showclose="true">
        <div id="Div3" style="margin: 10px; height: 450px;">
            <form class="l-hidden" name="doorForm2" method="post" action="" id="doorForm3">


                <div>
                </div>
                <table cellpadding="0" cellspacing="0" class="l-table-edit" >

                    <tr>
                        <td align="right" class="l-table-edit-td">是否采用多人规则:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="name" type="checkbox" ltype="checkbox" />
                        </td>
                        <td align="left"></td>
                    </tr>

                    <tr>
                        <td align="right" class="l-table-edit-td">人数要求:</td>
                        <td align="left" class="l-table-edit-td">
                            <select name="ddlDepart" ltype="select">
                                <option value="1">2</option>
                                <option value="2">3</option>
                                <option value="3">4</option>
                                <option value="4">5</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="l-table-edit-td">人组要求:</td>
                        <td align="left" class="l-table-edit-td">
                            <select name="ddlDepart0" ltype="select">
                                <option value="1">无要求</option>
                                <option value="2">有要求无顺序</option>
                                <option value="3">人组+顺序</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="l-table-edit-td">人组选择:</td>
                        <td align="left" class="l-table-edit-td">

                            <div id="listbox1"></div>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="l-table-edit-td">超时时间（秒）:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="code" type="text" ltype="text" />
                        </td>
                        <td align="left"></td>
                    </tr>
                </table>
                <br />
                <input type="hidden" name="id" />
                <input type="hidden" name="pid" />
                <input type="submit" value="提交" class="l-button l-button-submit" />
                <input type="reset" value="重置" class="l-button l-button-reset"/>
                <br class="l-clear" />
            </form>

        </div>
    </div>


</div>
<br />
</div>
</div>
</body>
</html>
